package com.wwy.hkapi.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @Author: wwy
 * @Date: 2021/3/9 15:37
 */
public class SDKUtils {
    private static final Logger LOGGER = LoggerFactory.getLogger(SDKUtils.class);
    public static Properties properties = new Properties();
    static {

        // 使用ClassLoader加载properties配置文件生成对应的输入流
        InputStream in = SDKUtils.class.getClassLoader().getResourceAsStream("hcNetSDK.properties");
        // 使用properties对象加载输入流
        try {
            properties.load(in);
            LOGGER.info("初始化成功,,sdkPath:{}",properties.get("sdkPath"));
        } catch (IOException e) {
            LOGGER.info(e.getMessage());
        }
    }

    /**
     * 获取配置参数
     * @param key
     * @return
     */
    public static String getSDKValue(String key){
        return String.valueOf(properties.get(key));
    }
}
